import Vue from "vue";
import App from "./App.vue";
import router from "@/router";
import store from "@/store";

// 注册全局组件
import TypeNav from "@/components/TypeNav";
import Carsousel from '@/components/Carousel'
import Pagination from '@/components/Pagination'
import { Button, MessageBox } from 'element-ui';
Vue.component(TypeNav.name, TypeNav);
Vue.component(Carsousel.name, Carsousel);
Vue.component(Pagination.name, Pagination);

// 挂载ElementUI组件
//注册全局组件
Vue.component(Button.name, Button);
//ElementUI注册组件的时候，还有一种写法，挂在原型上
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;

// 引入表单校验插件
import "@/plugins/validate";
// 引入MockServer.js
import '@/mock/mockServe'
// 引入Swiper的样式
import 'swiper/css/swiper.css'

// 统一引入api中的请求接口，供所有的组件使用
import * as API from '@/api'

Vue.config.productionTip = false;
let a = 1;
new Vue({
    render: (h) => h(App),
    // 配置全局事件总线$bus
    beforeCreate() {
        Vue.prototype.$bus = this;
        Vue.prototype.$API = API
    },
    router,
    store,
}).$mount("#app");